package com.xy.job.admin.domain.converter

import com.xy.job.admin.common.JSON
import com.xy.job.admin.domain.JobExtendConfig
import jakarta.persistence.AttributeConverter
import jakarta.persistence.Converter

@Converter
class JobExtendConfigConverter : AttributeConverter<JobExtendConfig, String> {

    override fun convertToDatabaseColumn(item: JobExtendConfig?): String {
        return JSON.writeValueAsString(item)
    }

    override fun convertToEntityAttribute(text: String?): JobExtendConfig {
        return JSON.readValue(text, JobExtendConfig::class.java)
    }
}